home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9518 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: misery.millcomm.com!usenet
  2. From: danhicks@millcomm.com (Dan Hicks)
  3. Newsgroups: comp.lang.misc,comp.lang.c,comp.lang.pl1
  4. Subject: Re: GOTO controversy
  5. Date: 11 Mar 1996 03:56:51 GMT
  6. Organization: Millennium Communications, Inc.
  7. Message-ID: <4i08a3$n9a@misery.millcomm.com>
  8. References: <4grt4e$8fg@goanna.cs.rmit.EDU.AU> <4hl8mt$4po@newshost.cyberramp.net> <wallaceDnvoEo.7L7@netcom.com> <Do2J4D.J4K@cix.compulink.co.uk>
  9. Reply-To: danhicks@millcomm.com
  10. NNTP-Posting-Host: dial-13.roch.millcomm.com
  11. X-Newsreader: IBM NewsReader/2 v1.2
  12.  
  13. In <Do2J4D.J4K@cix.compulink.co.uk>, jdm17@cix.compulink.co.uk ("John Meredith") writes:
  14. >
  15. >If a routine needs to perform some cleanup before returning
  16. >and there may be occasions where an early RETURN is required
  17. >(e.g. errors), then GO TO to transfer to a single clean-up-
  18. >and-return code block is neater than multiple copies of said
  19. >block.  Of course if the clean-up is complex, it would warrant
  20. >being a separate (internal?) procedure.
  21.  
  22. What would be better here would be a language that provided proper 
  23. structure -- ie, an Exit block that would always be executed when the 
  24. associated block is exited, whether by RETURN, GOTO, or exception.  I 
  25. once kludged this up with a macro processor and it did wonders for 
  26. recovery-intense code -- made for much cleaner, more structured code. 
  27. (Ran like a pig, but that was mostly due to the kludgy implementation. 
  28. And where we used it performance wasn't that much of an issue.)
  29.  
  30. Dan Hicks
  31. http://www.millcomm.com/~danhicks/
  32.  
  33.